from SyntaxDesc import *
from Register import *
def PythonSyntax():
	return SyntaxDesc(
		Words(gStyleKeyword,
			"del",
			"exec",
			"pass", "print",
			"and", "in", "is", "not", "or",		  
		),
		Words(gStyleStructKeyword,
			"break", "continue",
			"return", 
			"for", "while",
			"if", "elif", "else", "then",
		),
		Words(CharStyle(face=eFaceBold,rgb=(125,0,125)),
			"def", "class", "lambda",
			"import", "from",
		),
		Words(CharStyle(face=eFaceBold|eFaceUnderline,rgb=(0,125,125)),
			"try", "except", "raise", "finally",
		),
		MatchPair(gStyleString,'r"""','"""','\\\\','\\"""'),
		MatchPair(gStyleString,"r'''","'''","\\\\","\\'''"),
		MatchPair(gStyleString,'"""','"""','\\\\','\\"""'),
		MatchPair(gStyleString,"'''","'''","\\\\","\\'''"),
		Regex(gStyleString,
			'r?\("\([^\\"\n]\|\\\\.\|\\\\\n\)*"\|\'\([^\\\'\n]\|\\\\.\|\\\\\n\)*\'\)'
		),
		IfCommentHighlight(Regex(gStyleComment,'#.*')),
	)

def PythonKeymap(kh):
	kh.BindKey("Tab",Editor.SmartTab)
	kh.BindKey("Backspace",Editor.SmartBackspace)
	kh.BindKey("Del",Editor.SmartDelete)
	kh.BindKey("Space",Editor.SmartSpace)
	kh.BindKey("Left",Editor.SmartLeft)
	kh.BindKey("Right",Editor.SmartRight)
syntax=PythonSyntax()

RegisterSyntax(PythonSyntax,"Python")

RegisterKeys(PythonKeymap,"Python")

#RegisterMenu(menu,"Python")
